package com.example.ymm.modules1.controller;

import com.example.ymm.model.UserLogin;
import com.example.ymm.util.SecurityUtil;

import java.util.List;

public class BaseController {

    public UserLogin getUserLogin() {
        return SecurityUtil.getUserLogin();
    }

    public String getUserId() {
        return SecurityUtil.getUserId();
    }

    public String getUserName() {
        return getUserLogin().getUserName();
    }

    public String getUserRole() {
        List<String> roleList = getUserLogin().getRoleList();

        String role = "";
        if (roleList != null && roleList.size() > 0) {
            role = roleList.get(0);
        }
        return role;
    }

    public String getUserNickName() {
        return SecurityUtil.getUserNickName();
    }
}
